<!DOCTYPE html>
<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">

<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link rel="shortcut icon" href="favicon.ico">
     <link href="__PUBLIC__/home/css/bootstrap.min.css?v=3.3.5" rel="stylesheet">
    <link href="__PUBLIC__/home/css/font-awesome.min.css?v=4.4.0" rel="stylesheet">
    <link rel="stylesheet" type="text/css" href="__PUBLIC__/home/css/xcConfirm.css"/>
    <link href="__PUBLIC__/home/css/animate.min.css" rel="stylesheet">
    <link href="__PUBLIC__/home/css/style.min.css?v=4.0.0" rel="stylesheet">
    <style type="text/css">
    .gray-bg{
        background: #fff url(__PUBLIC__/home/images/97.jpg) no-repeat fixed center center / cover;
    }
    </style>
<link type="text/css" rel="stylesheet" href="__PUBLIC__/home/css/base.css">
<link type="text/css" rel="stylesheet" href="__PUBLIC__/home/css/style.css">
<script type="text/javascript" src="__PUBLIC__/home/js/jquery.min.js"></script> 
 <script src="__PUBLIC__/home/js/jquery-1.9.1.js" type="text/javascript" charset="utf-8"></script>
<script src="__PUBLIC__/home/js/xcConfirm.js" type="text/javascript" charset="utf-8"></script>

<script type="text/javascript" src="__PUBLIC__/home/js/utils.js"></script>
{insert_scripts files="transport.js"}
<script type="text/javascript">
var InterValObj; //timer变量，控制时间
var count = 30; //间隔函数，1秒执行
var curCount;//当前剩余秒数

function sendMessage() {
    curCount = count;
    var user_name=$("#user_name").val();//手机号码
    var cardno=$("#cardno").val();//手机号码
    if(user_name != "" && cardno != ""){
        
       
    //向后台发送处理数据
         $.ajax({
                    type : 'POST',
                    url : '/home/login/phoneAjax',
                    data : {user_name:user_name,cardno:cardno},
                    dataType : 'html',
                    async : false,
                    success : function(str){                       
                         if(str == '发送成功'){                            
                            //设置button效果，开始计时
                            $("#btnSendCode").attr("disabled", "true");
                            $("#btnSendCode").val("请在" + curCount + "秒内输入验证码");
                            InterValObj = window.setInterval(SetRemainTime, 1000); //启动计时器，1秒执行一次
                        }else{
                               var txt=  "信息错误,请核对后再添";
                               window.wxc.xcConfirm(txt, window.wxc.xcConfirm.typeEnum.info);
                        }                        
                    }
                
                })
    }else{
         var txt=  "用户名或者身份证未填写";
         window.wxc.xcConfirm(txt, window.wxc.xcConfirm.typeEnum.error);
    }
}
//timer处理函数
function SetRemainTime() {
    if (curCount == 0) {                
        window.clearInterval(InterValObj);//停止计时器
        $("#btnSendCode").removeAttr("disabled");//启用按钮
        $("#btnSendCode").val("重新发送验证码");
        code = ""; //清除验证码。如果不清除，过时间后，输入收到的验证码依然有效    
    }
    else {
        curCount--;
        $("#btnSendCode").val("请在" + curCount + "秒内输入验证码");
    }
}

//修改密码
   function checkSubmit(){

        if($('#newpassword').val()==''||$('#repassword').val()==''){
            var txt=  "密码未填写";
             window.wxc.xcConfirm(txt, window.wxc.xcConfirm.typeEnum.error);
             return false;
        }
        if($('#newpassword').val()!=$('#repassword').val()){
                 var txt=  "两次密码输入不同";
         window.wxc.xcConfirm(txt, window.wxc.xcConfirm.typeEnum.error);
         return false;
        }

         $.ajaxSetup({
             headers: {
                'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
             }
        });
        $.ajax({
            type:'POST',
            data:{newpassword:$('#newpassword').val(),mobile_code:$('#mobile_code').val(),user_name:$('#user_name').val()},
            url:'/home/login/editPassword',
            dataType : 'html',
            async : false,
            success : function(str){
                if(str==1){
                    var txt=  "修改成功,请重新登录";
                    window.wxc.xcConfirm(txt, window.wxc.xcConfirm.typeEnum.success);
                   return false;
                }
                if(str==222){
                    var txt=  "验证码不正确";
                    window.wxc.xcConfirm(txt, window.wxc.xcConfirm.typeEnum.error);
                    return false;
                    
                }
                if(str==22){
                    var txt=  "修改失败,请核对信息后再做修改";
                    window.wxc.xcConfirm(txt, window.wxc.xcConfirm.typeEnum.error);
                    return false;
                }
            }
        })
    return false;
   }
</script>
</head>

<body class="gray-bg">

 <div class="middle-box text-center loginscreen  animated fadeInDown" >
 
            <div>
                <h1 class="logo-name"><img width="150px" alt="" src="__PUBLIC__/home/images/logo00.png"></h1>
            </div>
            
           
<form style="padding:0% 6%" role="form" action="__MODULE__/login/editpassword" method="post" name="theForm" onSubmit="return checkSubmit(this)">
<div class="form-group ">

<input name="user_name" class="form-control" id="user_name" type="text" placeholder=" 用户名称">

</div>
<div class="form-group ">

<input name="cardno" class="form-control" id="cardno" type="text" placeholder="身份证号码">

</div>
<div class="form-group ">

<input id="mobile_code" class="form-control" name="mobile_code"  type="text" placeholder="手机验证码" >

</div>
<div class="form-group">

<input class="form-control" style="background-color:#EEEEEE" type="button" value="获取手机验证码" id="btnSendCode" onclick="sendMessage()" />


</div>
<div class="form-group ">

<input name="newpassword" class="form-control" id="newpassword" type="password" placeholder="输入新密码">

</div>
<div class="form-group ">

<input name="repassword" class="form-control" id="repassword" type="password" placeholder="确认新密码">

</div>



<div class="form-group ">
<input  onclick="checkForm();" class="form-control"  type="submit" value="确认修改" style="background-color:#0073B7">
<!--  <button type="button" class="btn btn-primary form-control" ">确认修改</button>-->
</div>
<div class="form-group ">
<a class="form-control" href='__MODULE__/login/index' style='background-color:#0073B7'>返回登录界面</a>
<!--  <button type="button" class="btn btn-primary form-control" ">确认修改</button>-->
</div>
</form>

</div>
    

<img src="__PUBLIC__/home/images/97.jpg" class="bg">

<!-- 
<div class="btn_edit" style="padding-left:30%" >
<a href = "javascript:;" onclick="actForm();">确认修改</a>
    <a href="rp_user.php" >返回</a></div> 
</div>
 -->
</body></html>